<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.js"></script>
</head>
<template id="cpn_id">
    <div>
       <p>{{msg}}</p>
    </div>
</template>
<body>
<div id="div_id">
    <cpn ref="aaa" v-bind:msg="message"></cpn>
    <button v-on:click="btnClick">按钮</button>
</div>
<script>
    const app=new Vue({
        el:"#div_id",
        data:{
            message:"这是消息",
            //childMsg:this.$children.
        },
        methods:{
            btnClick(){
                //console.log(this.$children[0].msg);
                console.log(this.$refs.aaa.msg);
            }
        },
        components:{
            cpn:{
                //在这里注册子组件
                template:"#cpn_id",
                props:{
                    msg:String,
                    default:''
                }
            }
        }
    })
</script>
</body>
</html>